﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using HousingInfo.Library;
using System.IO;

namespace WebHousingInfo.Controls
{
    public partial class ManagerUser_left : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["UserName"] == null || Session["UserName"] == "")
                    Response.Redirect("DangNhap.aspx");
                GettotalNewsHouse();
            }
        }

        public void GettotalNewsHouse()
        {
            lbltraphi.Text = "[" + NewsHouseBOList.GetType_NewsHousesBOList_ByUserName(Session["UserName"].ToString(), false, true, false, false, false, false).Count.ToString() + "]";
            lblchoduyet.Text = "[" + NewsHouseBOList.GetType_NewsHousesBOList_ByUserName(Session["UserName"].ToString(), false, false, false, true, false, false).Count.ToString() + "]";
            lbldangdang.Text = "[" + NewsHouseBOList.GetType_NewsHousesBOList_ByUserName(Session["UserName"].ToString(), false, false, true, false, false, false).Count.ToString() + "]";
            lbldaluu.Text = "[" + NewsHouseBOList.GetType_NewsHousesBOList_ByUserName(Session["UserName"].ToString(), false, false, false, false, true, false).Count.ToString() + "]";
            lblhethan.Text = "[" + NewsHouseBOList.GetType_NewsHousesBOList_ByUserName(Session["UserName"].ToString(), false, false, false, false, false, true).Count.ToString() + "]";
            lbltatca.Text = "[" + NewsHouseBOList.GetType_NewsHousesBOList_ByUserName(Session["UserName"].ToString(), true, false, false, false, false, false).Count.ToString() + "]";
        }
        public bool checkurlimage(string imagestring)
        {
            var pathFileImage = Server.MapPath("TotalUpload/UserAvatar/" + imagestring);
            if (File.Exists(pathFileImage))
            {
                return true;
            }
            else return false;
        }
    }
}